import React            from 'react';

import history          from '../utils/history';
import {sendMessage}    from '../actions';

const trim = s => s.trim();

export default class Base extends React.Component {

    router = history;
    params = _.get(this.props.match, 'params', {});

    handleChange = (name, extra = trim) => e => this.setState({[name]: extra(e.target.value)});

    alert(){
        return this.context.store.dispatch(sendMessage.apply(undefined, arguments));
    }

}

Base.contextTypes = {store: () => {}};
